package mrms.api.repository;

import mrms.api.entity.RoomEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author lenchu
 * @date 2019/02/05
 */
public interface RoomRepository extends JpaRepository<RoomEntity, String> {

    /**
     * 按会议室最大容纳人数查询
     * @param size
     * @param pageable
     * @return
     */
    Page<RoomEntity> findAllBySizeGreaterThanEqual(Integer size, Pageable pageable);

    /**
     * 按类型查
     * @param type
     * @return
     */
    List<RoomEntity> findAllByTypeGreaterThanEqual(Integer type);


    RoomEntity findRoomEntityById(String id);
    List<RoomEntity> findRoomEntitiesByAirconditionerGreaterThanEqualAndMediaGreaterThanEqualAndFloorAndSizeGreaterThanEqualAndTypeOrderBySizeAsc(int air,int media,int floor,int size,int type);
    List<RoomEntity> findRoomEntitiesByAirconditionerGreaterThanEqualAndMediaGreaterThanEqualAndSizeGreaterThanEqualAndTypeOrderBySizeAsc(int air,int media,int size,int type);

    List<RoomEntity> findRoomEntitiesByAirconditionerGreaterThanEqualAndMediaGreaterThanEqualAndSizeGreaterThanAndFloorAndType(int air,int media,int size,int floor,int type);
    List<RoomEntity> findRoomEntitiesByAirconditionerGreaterThanEqualAndMediaGreaterThanEqualAndSizeGreaterThanAndType(int air,int media,int size,int type);

}
